<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<script type=text/javascript>
 function show(id){
 	document.getElementById("hidden"+id).style.display='block';
 	document.getElementById("href"+id).href='javascript:hidden('+id+');';
 	document.getElementById("span"+id).innerHTML="收起";
 	document.getElementById("a"+id).href='javascript:hidden('+id+');';
 }
 function hidden(id){
 	document.getElementById("hidden"+id).style.display='none';
 	document.getElementById("href"+id).href='javascript:show('+id+');';
 	document.getElementById("span"+id).innerHTML="查看详细";
 	document.getElementById("a"+id).href='javascript:show('+id+');';
 }
 
function MM_jumpMenu(selObj){  
	if(selObj.options[selObj.selectedIndex].value!="请选择老师"){
		window.location.href = selObj.options[selObj.selectedIndex].value; 
	} 
}
 </script>


<div align="center">
   <table class="main">
      <tr align="left"><td valign="top">
         <div id="location"><img src="<%=basePath %>images/c4.jpg"/>&nbsp;&nbsp;当前位置：&nbsp;题目列表</div>
         <div id="content">
            <c:if test="${projects.size()==0 }"><p>没有更多题目了！</p></c:if>
            <% int i = 0; %>
            <c:if test="${projects.size()>0 }">
               <table width="100%" frame="below" >
                  <tr align="left"><td width="80%">选择老师</td><td width="20%" align="right">
                      <select onchange="MM_jumpMenu(this)">
                          <option selected="selected" value="请选择老师">请选择老师</option>
                          <c:forEach items="${teachers}" var="t">
                             <option value="getProjectsByTeacher${t.id }&1">${t.name }</option>
                          </c:forEach>
                      </select>
                  </td></tr>
               </table>
               <c:forEach items="${projects}" var="p">
                  <table width="100%" class="list"><from>
                     <% i++; %>
                     <tr align="left" style="border-bottom:1px #ccc solid;"><td><a href="javascript:show(<%=i %>);" style="color:#349C9F;" id="a<%=i %>">${p.name }</a>
                        <a id="href<%=i %>" href="javascript:show(<%=i %>);"><span id="span<%=i %>">查看详细</span></a></td>
                     </tr>
                     <tr><td>
                        <table id="hidden<%=i %>" style="display:none;border-bottom:1px #999 solid;" width="100%">
                          <tr><td class="span">题目描述:</td></tr>
                          <tr><td>${p.description }</td></tr>
                          <tr><td class="span">导师信息:</td></tr>
                          <tr><td>
                             <div>导师姓名：${p.teacher.name }</div><div>性别：${p.teacher.gender }</div>
                             <div>联系电话：${p.teacher.telephone }</div><div>&nbsp;q&nbsp;&nbsp;q：${p.teacher.qq }</div>
                          </td></tr>
                          <tr><td class="span">给导师的留言:</td></tr>
                          <tr><td> 
                             <input type="hidden" class="id" value="${p.id }" />
                             <textarea rows="" cols="105" class="message"></textarea> 
                             <input type="button" class="intent" value="确认留言" style="margin-left:300px;margin-top:10px;margin-bottom:10px;" ></td></tr>
                       </table>
                     </td></tr>
                  </from></table>
               </c:forEach><br /><br />
               <p align="center"><a href="getProjectsByTeacher${tea_id }&1"><input type="button" class="btn" value="首页"></a>
                   <a href="getProjectsByTeacher${tea_id }&<c:if test='${page==1}'>1</c:if><c:if test='${page>1}'>${page-1 }</c:if>">
                   <input type="button" class="btn" value="上一页"></a>
                                                                  当前第${page }页
                   <a href="getProjectsByTeacher${tea_id }&${page+1 }"><input type="button" class="btn" value="下一页"></a>
                   <a href=""><input class="btn" type="button" value="尾页"></a></p>
            </c:if>
         </div>
      </td></tr>
   </table>
</div>